<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>登录-江城巴士</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="favicon.ico">
    
    <link rel="stylesheet" href="css/app.css">
</head>

<body class="bg-login">


<section class="wrap login-box">
    <div class="avatar">
        <img src="images/avatar.png" alt="">
    </div>

    <form action="">
        <div class="form">
            <div class="item">
                <img src="images/a/user.png" />
                <input type="text" class="ipt" name="" id="username" />
                <span class="error"></span>
            </div>

            <div class="item">
                <img src="images/a/lock.png" />
                <input type="password" class="ipt" name="" id="pwd" />
                <span class="error"></span>
            </div>

            <div class="item cf">
                <a href="find_password.html" class="fr">忘记密码？</a>
                <a href="register.html">注册</a>
            </div>

        </div>
        
        <div class="button">
            <button type="submit" class="ubtn ubtn-white" id="submit">登录</button>
        </div>
    </form>

</section>


<script src="js/zepto.min.js"></script>
<script>
$(function() {
    var $username = $('#username'),
        $pwd = $('#pwd');

    function checkUsername() {
        var val = $username.val();
        if (!val) {
            $username.next().html('请输入会员名').show();
        } else {
            $username.next().html('').hide();
            return true;
        }
        $username.focus();
        return false;
    }
    function checkPwd() {
        var val = $pwd.val();
        if (!val) {
            $pwd.next().html('请输入密码').show();
        } else {
            $pwd.next().html('').hide();
            return true;
        }
        $pwd.focus();
        return false;
    }
    function checkIpt() {
        if (checkUsername() && checkPwd()) {
            return true;
        }
        return false;
    }
    // 保存
    $('#submit').on('click', function() {
        return checkIpt();
    });

    $('body').on('click', function() {
        $('.error').html('').hide();
    })
});

</script>

</body>
</html>